import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { SelectExcelButton } from '../Common/options'
import dayjs from 'dayjs'

export const ProjectMonthAvgScore = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        type: '项目评分',
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`getScoreManagementGetProjectMonthAvgScore`],
        options: [
            <SelectExcelButton
                key="excel"
                title="下载Excel"
                OptionsEvent={OptionsEvent}
                api={API_LIST()['getScoreManagementGetProjectMonthAvgScoreExcel']}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'beginSecurityDate',
                title: '开始日期',
                valueType: 'Date',
                picker: 'month',
                rules: true,
                width: 150,
                initialValue: dayjs().format('YYYY-MM'),
                hideInTable: true,
            },
            {
                dataIndex: 'endSecurityDate',
                title: '结束日期',
                valueType: 'Date',
                picker: 'month',
                rules: true,
                width: 150,
                initialValue: dayjs().format('YYYY-MM'),
                hideInTable: true,
            },
            {
                dataIndex: 'projectName',
                title: '项目名称',
                valueType: 'input',
                rules: true,
                width: 450,
                hideInSearch: true,
            },
            {
                dataIndex: 'projectScore',
                title: '总分',
                valueType: 'input',
                rules: true,
                width: 100,
                hideInSearch: true,
            },
            {
                dataIndex: 'monthCount',
                title: '月数量',
                valueType: 'input',
                rules: true,
                width: 100,
                hideInSearch: true,
            },
            {
                dataIndex: 'avgProjectScore',
                title: '平均分',
                valueType: 'input',
                rules: true,
                width: 100,
                hideInSearch: true,
            },
        ],
    }
    return data
}
